package com.mydemo.design_pattern.structure_type.proxy_pattern.jdk;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * <p></p >
 *
 * @author liming1
 * @version $Id: MyProxy, v1.0 2019-09-19 11:30 liming1 Exp $
 */
public class MyProxy implements InvocationHandler {

    private Subject proxyObject;

    public MyProxy(Subject o) {
        this.proxyObject = o;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("开始代理");
        proxyObject.name();
        return null;
    }
}
